# 导包
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
# 获取浏览器驱动
driver = webdriver.Firefox()
driver.maximize_window()
# 打开测试页面
url = 'file:///C:/Users/tedu/Desktop/NSD2406/html/register.html'
driver.get(url)

driver.find_element(By.CSS_SELECTOR, '#user').send_keys('admin')
# 1.刷新
# sleep(3)
# driver.refresh()
# 点击新浪打开新窗口
# driver.find_element(By.PARTIAL_LINK_TEXT, '新浪').click()
# sleep(3)
# # 2.关闭主窗口
# driver.close()
# 4.获取当前网页的标题
title = driver.title
# 5.获取当前网页的URL
url = driver.current_url
print('标题：', title)
print('网址：', url)

# 关闭浏览器驱动
sleep(3)
# 3.关闭所有窗口
driver.quit()